﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<BGCMS.Models.ArticleListViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    ListOfArticlesByKeyword
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="leftside">
        <h2>
            Flokkar</h2>
        <ul>
            <% foreach (var k in Model.OtherKeywords)
               { %>
            <li>
                <%: Html.ActionLink(k.Title, "ListOfArticlesByKeyword", "Home", new { k.ID }, null)%></li>
            <% } %>
        </ul>
    </div>
    <h2>
        <%: Model.Keyword.Title %></h2>
    <div id="content">
        <% foreach (var a in Model.Articles)
           {%>
        <div class="articlelist">
            <h3>
                <a href="/Article/Article/<%: a.ID %>" id="einhverlinkur">
                    <%: a.Title %>
                </a>
            </h3>
            <p>
                <% if (a.TextBody.Length < 800)
                   { %>
                <%= System.Web.HttpUtility.HtmlDecode(a.TextBody)%>
                <% } %>
                <% else
                   { %>
                <% dynamic s = a.TextBody; %>
                <% dynamic r = s.Substring(286, 780); %>
                <%= System.Web.HttpUtility.HtmlDecode(r)%>
                <%} %>
            </p>
            <p>
                <%: Html.ActionLink("Sjá Meira", "Article", "Article", new { a.ID }, null)%>
            </p>
            <% } %>
            <br />
        </div>
    </div>
</asp:Content>